import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { HttpClient} from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class VideoService {

  constructor(private router:Router,private http:HttpClient) {
    
   }
   goVideoDetail(id:number){
    this.router.navigate(["/bvideo/video"],{queryParams:{id:id}})
}


// async getVideoDataFromFetch(){
//   let response = await fetch("http://metapunk.cn:9999/parse/classes/VideoWork?limit=3", {
//       "credentials": "omit",
//       "headers": {
//           "X-Parse-Application-Id": "dev",
//       },
//       "method": "GET",
//       "mode": "cors"
//   })
  
//     let data = await response.json()
//     const VideoWorkList = data.results;
// console.log("VideoWorkList1",VideoWorkList)
// console.log("VideoWorkList2",VideoWorkList)
// }}
// getVidoeByIdFromHttp(objectId:string){
//   // RESTful APIs 文档：https://docs.parseplatform.org/rest/guide/#queries
//   let serverURL = `http://metapunk.cn:9999/parse`
//   let appId = "dev"
//   let url = `${serverURL}/classes/VideoWork?where={"objectId":"${objectId}"}`
//   return this.http.get(url,{
//     headers:{
//       "X-Parse-Application-Id": appId
//     }
//   })
// }
// getNoteListFromHttp(){
//   // RESTful APIs 文档：https://docs.parseplatform.org/rest/guide/#queries
//   // AJAX XMLHttpRequest https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest
//   // ES6 fetch https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API/Using_Fetch
//   // 微信小程序 https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
//   // Angular Http https://angular.cn/guide/http
//   let serverURL = `http://metapunk.cn:9999/parse`
//   let appId = "dev"
// //   curl -X GET \
// // -H "X-Parse-Application-Id: ${APPLICATION_ID}" \
//   let url = `${serverURL}/classes/TravelNote`
//   return this.http.get(url,{
//     headers:{
//       "X-Parse-Application-Id": appId
//     }
//   })
// }

// getVideoByIdFromHttp(objectId:string){
//   // RESTful APIs 文档：https://docs.parseplatform.org/rest/guide/#queries
//   let serverURL = `http://metapunk.cn:9999/parse`
//   let appId = "dev"
//   let url = `${serverURL}/classes/VideoWork?where={"objectId":"${objectId}"}`
//   return this.http.get(url,{
//     headers:{
//       "X-Parse-Application-Id": appId
//     }
//   })
// }

// async getVideoDataFromFetch(){
//   let response = await fetch("http://metapunk.cn:9999/parse/classes/VideoWork?limit=3", {
//       "credentials": "omit",
//       "headers": {
//           "X-Parse-Application-Id": "dev",
//       },
//       "method": "GET",
//       "mode": "cors"
//   })
  
//     let data = await response.json()
//     const VideoWorkList = data.results;
// console.log("VideoWorkList1",VideoWorkList)
// console.log("VideoWorkList2",VideoWorkList)
// }

}


